﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel.Syndication;
using ajayumi.develop.win32.GRssReader.Service.Model;

namespace ajayumi.develop.win32.GRssReader.Service
{
    public class Utility
    {
        /// <summary>
        /// Get the text from a TextSyndicationContent.
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        public static string GetTextSyndicationContent(SyndicationContent content)
        {
            TextSyndicationContent txt = content as TextSyndicationContent;
            if (txt != null)
                return txt.Text;
            else
                return "";
        }

        internal  static IEnumerable<ArticleImageInfo> GetImageResourceList(string htmlCode)
        {
            List<string> lst = WebResourcesCatcher.Service.WebResourceService.GetResourcesList(htmlCode, WebResourcesCatcher.Service.ResourceType.Image );

            return lst.Select(o => new ArticleImageInfo(o));
        }
    }
}
